package com.imesne.assistant.jdbc.command;

import com.imesne.assistant.jdbc.management.CommandTable;
import com.imesne.assistant.jdbc.mapping.MappingHandler;
import com.imesne.assistant.jdbc.page.PageHandler;
import com.imesne.assistant.jdbc.persist.PersistExecutor;

/**
 * Created by liyd on 17/4/19.
 */
public abstract class AbstractCommandExecutor {

    protected Class<?> type;

    protected CommandContextBuilder commandContextBuilder;

    protected PersistExecutor persistExecutor;

    protected PageHandler pageHandler;

    protected String dialect;

    protected MappingHandler mappingHandler;

    protected CommandTable commandTable;

    public AbstractCommandExecutor() {
        commandTable = new CommandTable();
    }

    public void setMappingHandler(MappingHandler mappingHandler) {
        this.mappingHandler = mappingHandler;
        this.commandTable.setMappingHandler(mappingHandler);
    }

    public void setType(Class<?> type) {
        this.type = type;
        commandTable.setType(type);
    }

    public void setCommandContextBuilder(CommandContextBuilder commandContextBuilder) {
        this.commandContextBuilder = commandContextBuilder;
    }

    public void setPersistExecutor(PersistExecutor persistExecutor) {
        this.persistExecutor = persistExecutor;
    }

    public void setPageHandler(PageHandler pageHandler) {
        this.pageHandler = pageHandler;
    }

    public void setDialect(String dialect) {
        this.dialect = dialect;
    }

}
